package rolePra.controller;

import rolePra.model.Role;
import rolePra.service.RoleService;
import rolePra.service.impl.RoleServiceImpl;

import java.util.List;

public class RoleTest {
    //利用scanner进行测试
    public static void main(String[] args) {
        //调用业务层中的操作
        RoleService roleService = new RoleServiceImpl();
        Role role = new Role(1, "admin", "管理员");
        Role role1 = new Role(2, "user", "普通用户");
        Role role2 = new Role(3, "dev", "开发者");
        roleService.insertRole(role);
        roleService.insertRole(role1);
        roleService.insertRole(role2);

        List<Role> list = roleService.getAllRoles();

        for (Role role3 : list) {
            System.out.println(role3);
        }
        System.out.println("++++++++++++++++++++++++++++++++++++++++");
        RoleService roleService2 = new RoleServiceImpl();
        Role role4 = new Role(4, "design", "设计师");
        roleService2.insertRole(role4);
        for (Role r : roleService2.getAllRoles()) {
            System.out.println(r);
        }
    }

}
